#!/usr/bin/env python
# @FileName :01-19.py
# @Time :2024/1/19 17:18
# @Author :qiqianxu

# 从回文定义下手,简单粗暴
msg = input().lower()
new_msg = ""
for c in msg:
    if c.isalnum():
        new_msg += c

reverse = new_msg[::-1]
if reverse == new_msg:
    print("是回文")
else:
    print("不是回文")


# 通过下标一个个对比
msg = input().lower()
new_msg = ""
for c in msg:
    if c.isalnum():
        new_msg += c

for i in range(0, len(new_msg)//2):
    if new_msg[i] != new_msg[-1-i]:
        print("不是回文")
        break
else:
    print("是回文")
